import { useRequest } from '@/hooks';
import { message } from 'antd';
import { getInterviewRoundList } from '../Setting/service';

export default function useInterviewRoundList() {
    // 获取面试轮次列表
    const { data, loading } = useRequest(getInterviewRoundList, {
        initialData: [],
        formatResult: res => {
            if (res) {
                const { code, data: d, msg } = res;
                if (code === 10000) {
                    return d?.map(item => ({
                        text: item?.interviewName || '',
                        label: item?.interviewName || '',
                        value: item?.id || ''
                    }));
                }
                message.error(msg);
            }
            return undefined;
        }
    });

    return { data, loading };
}
